/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * JInternalFrameManageProduct.java
 *
 * Created on Dec 13, 2011, 3:40:33 PM
 */
package bugreportingsystem;

import Util.CommonQuery;
import Util.Produce;
import Util.Producer;
import java.awt.Color;
import java.awt.Font;
import java.text.Normalizer.Form;
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.Stack;
import java.util.Vector;
import javax.swing.BorderFactory;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JOptionPane;
import javax.swing.border.Border;
import javax.swing.border.EtchedBorder;
import javax.swing.border.TitledBorder;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author PhucTakua
 */
public class JInternalFrameManageProduct extends javax.swing.JInternalFrame {
    int rowcer = -1;
    int idemcer;
    private Vector<Integer> IdProducer = new Vector<Integer>();
    private Vector<String> NameProducer = new Vector<String>();
    int row = -1;
    int idem;
    private String language = JFrameLogin.language;
    private String country = JFrameLogin.country;
    private Locale lc = new Locale(language, country);
    private ResourceBundle rb = ResourceBundle.getBundle("bugreportingsystem/resources/JInternalFrameManageProduct", lc);

    /** Creates new form JInternalFrameManageProduct */
    public JInternalFrameManageProduct() {
        initComponents();
        DisplayTableProducer(Producer.ListIDProducer());
        AddNameProducer();
        DisplayTableProduce(Produce.ListIDProducec());
        MyTranslate();
    }
    private TitledBorder SetTitleBorder(String a) {
        Border etched = BorderFactory.createEtchedBorder();
        Font font = new Font("Tahoma", Font.BOLD, 14);
        TitledBorder Title = BorderFactory.createTitledBorder(etched, rb.getString(a));
        Title.setTitleJustification(TitledBorder.LEFT);
        Title.setTitleFont(font);
        Title.setTitleColor(Color.getColor("BLUE", 204));
        return Title;
    }
    private void MyTranslate() {
        this.setTitle(rb.getString("Form.title"));
        jLabelNameProducer.setText(rb.getString("jLabelNameProducer.text"));
        jButtonAdd.setText(rb.getString("jButtonAdd.text"));
        jButtonUpdate.setText(rb.getString("jButtonUpdate.text"));
        jButtonDelete.setText(rb.getString("jButtonDelete.text"));
        jButtonReset.setText(rb.getString("jButtonReset.text"));
        jPanel1.setBorder(SetTitleBorder("jPanel1.border.title"));
        jTabbedPane1.setTitleAt(0, rb.getString("jPanelProducer.TabConstraints.tabTitle"));
        jTabbedPane1.setTitleAt(1, rb.getString("jPanelProduce.TabConstraints.tabTitle"));
        jPanelIfomation.setBorder(SetTitleBorder("jPanelIfomation.border.title"));
        jLabel13.setText(rb.getString("jLabel13.text"));
        jLabel14.setText(rb.getString("jLabel14.text"));
        jLabel15.setText(rb.getString("jLabel15.text"));
        jLabelID.setText(rb.getString("jLabelID.text"));
        jLabel16.setText(rb.getString("jLabel16.text"));
        jButtonadd.setText(rb.getString("jButtonadd.text"));
        jButtonUpdate1.setText(rb.getString("jButtonUpdate1.text"));
        jButtonClean.setText(rb.getString("jButtonClean.text"));
        jButtonDelete1.setText(rb.getString("jButtonDelete1.text"));
        jButtonReset1.setText(rb.getString("jButtonReset1.text"));
        jLabelMonth.setText(rb.getString("jLabelMonth.text"));
    }

    private void DisplayTableProducer(Vector<Producer> listidpdr) {
        Vector<String> cols = new Vector<String>();
        cols.add("ID Producer");
        cols.add("Name Producer");
        Vector<Vector> rows = new Vector<Vector>();
        Producer pdr = new Producer();
        for (Producer i : listidpdr) {
            Vector<Object> pd = new Vector<Object>();
            pd.add(i.getIdproducer());
            pd.add(i.getNameproducer());
            rows.add(pd);
        }
        DefaultTableModel dtb = new DefaultTableModel(rows, cols) {

            @Override
            public boolean isCellEditable(int row, int column) {
                return false;
            }
        };
        this.jTableProducer.setModel(dtb);
        this.jTableProducer.getTableHeader().setReorderingAllowed(false);
    }

    private void DisplayProducer() {
        rowcer = this.jTableProducer.getSelectedRow();
        idemcer = Integer.parseInt(this.jTableProducer.getValueAt(rowcer, 0).toString());
        this.jTextFieldNameProducer.setText(this.jTableProducer.getValueAt(rowcer, 1).toString());
    }

    private void AddNameProducer() {
        Producer pdr = new Producer();
        IdProducer.removeAllElements();
        NameProducer.removeAllElements();
        for (Producer i : pdr.ListIDProducer()) {
            IdProducer.add(i.getIdproducer());
            NameProducer.add(i.getNameproducer());
        }
        DefaultComboBoxModel dcb = new DefaultComboBoxModel(NameProducer);
        this.jComboBoxIdProducer.setModel(dcb);
    }

    private void DisplayTableProduce(Vector<Produce> listidpd) {
        Vector<String> cols = new Vector<String>();
        cols.add("ID Produce");
        cols.add("Name Produce");
        cols.add("Price");
        cols.add("Warranty");
        cols.add("Information");
        cols.add("Name Producer");
        Vector<Vector> rows = new Vector<Vector>();
        Produce pd = new Produce();
        for (Produce i : listidpd) {
            Vector<Object> idpd = new Vector<Object>();
            idpd.add(i.getIdproduce());
            idpd.add(i.getNameproduce());
            idpd.add(i.getPrice());
            idpd.add(i.getWarranty());
            idpd.add(i.getInfor());
            idpd.add(Producer.ListNameProducer(i.getIdproduce()));
            rows.add(idpd);
        }
       DefaultTableModel dtc = new DefaultTableModel(rows, cols) {

            @Override
            public boolean isCellEditable(int row, int column) {
                return false;
            }
        };
        this.jTableProduce.setModel(dtc);
        this.jTableProduce.getTableHeader().setReorderingAllowed(false);
    }
   private void DisplayProduce() {
        row = this.jTableProduce.getSelectedRow();
        idem = Integer.parseInt(this.jTableProduce.getValueAt(row, 0).toString());
        this.jTextFieldNameProduce.setText(this.jTableProduce.getValueAt(row, 1).toString());
        this.jTextFieldPrice.setText(this.jTableProduce.getValueAt(row, 2).toString());
        this.jTextFieldWarranty.setText(this.jTableProduce.getValueAt(row, 3).toString());
        this.jTextAreaInformation.setText(this.jTableProduce.getValueAt(row, 4).toString());
        this.jComboBoxIdProducer.setSelectedItem(this.jTableProduce.getValueAt(row, 5).toString());
    }
    private boolean CheckNameProducer(String a1) {

        boolean kq = true;
        String a = a1.trim();
        Vector<Producer> listid = Producer.ListIDProducer();
        for (Producer p : listid) {
            if (p.getNameproducer().equals(a)) {
                kq = false;
            }
        }
        return kq;
    }
    private boolean CheckNameProduce(String a1) {

        boolean kq = true;
        String a = a1.trim();
        Vector<Produce> listid = Produce.ListIDProducec();
        for (Produce p : listid) {
            if (p.getNameproduce().equals(a)) {
                kq = false;
            }
        }
        return kq;
    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        java.awt.GridBagConstraints gridBagConstraints;

        jPanel5 = new javax.swing.JPanel();
        jPanel6 = new javax.swing.JPanel();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanelProducer = new javax.swing.JPanel();
        jPanelTitle2 = new javax.swing.JPanel();
        jPanel3 = new javax.swing.JPanel();
        jPanel1 = new javax.swing.JPanel();
        jPanelName2 = new javax.swing.JPanel();
        jLabelNameProducer = new javax.swing.JLabel();
        jTextFieldNameProducer = new javax.swing.JTextField();
        jPanel8 = new javax.swing.JPanel();
        jButtonAdd = new javax.swing.JButton();
        jButtonUpdate = new javax.swing.JButton();
        jButtonDelete = new javax.swing.JButton();
        jButtonReset = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jPanelTabale2 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTableProducer = new javax.swing.JTable();
        jPanel2 = new javax.swing.JPanel();
        jPanel20 = new javax.swing.JPanel();
        jPanel22 = new javax.swing.JPanel();
        jPanel23 = new javax.swing.JPanel();
        jPanel24 = new javax.swing.JPanel();
        NameProducer1 = new javax.swing.JLabel();
        jPanel21 = new javax.swing.JPanel();
        jPanelProduce = new javax.swing.JPanel();
        jPanelManage_Produce = new javax.swing.JPanel();
        jPanelBody = new javax.swing.JPanel();
        jPanelIfomation = new javax.swing.JPanel();
        jPanel4 = new javax.swing.JPanel();
        jPanel7 = new javax.swing.JPanel();
        jPanel9 = new javax.swing.JPanel();
        jPanel10 = new javax.swing.JPanel();
        jLabel13 = new javax.swing.JLabel();
        __ = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        __1 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        __2 = new javax.swing.JLabel();
        jPanel11 = new javax.swing.JPanel();
        jTextFieldNameProduce = new javax.swing.JTextField();
        jLabelNameProduce = new javax.swing.JLabel();
        jTextFieldPrice = new javax.swing.JTextField();
        jLabelPrice = new javax.swing.JLabel();
        jPanel28 = new javax.swing.JPanel();
        jTextFieldWarranty = new javax.swing.JTextField();
        jLabelMonth = new javax.swing.JLabel();
        jLabelWarranty = new javax.swing.JLabel();
        jPanel12 = new javax.swing.JPanel();
        jPanel13 = new javax.swing.JPanel();
        jLabelID = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jPanel14 = new javax.swing.JPanel();
        jPanel15 = new javax.swing.JPanel();
        jComboBoxIdProducer = new javax.swing.JComboBox();
        jLabelID1 = new javax.swing.JLabel();
        jPanel25 = new javax.swing.JPanel();
        jPanel26 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextAreaInformation = new javax.swing.JTextArea();
        jPanel27 = new javax.swing.JPanel();
        jLabelInformation = new javax.swing.JLabel();
        jPanel16 = new javax.swing.JPanel();
        jPanel17 = new javax.swing.JPanel();
        jPanel18 = new javax.swing.JPanel();
        jButtonadd = new javax.swing.JButton();
        jButtonUpdate1 = new javax.swing.JButton();
        jButtonClean = new javax.swing.JButton();
        jButtonDelete1 = new javax.swing.JButton();
        jButtonReset1 = new javax.swing.JButton();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        jPanel19 = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        jTableProduce = new javax.swing.JTable();
        jLabel21 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        jLabel23 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();

        setClosable(true);
        setIconifiable(true);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(bugreportingsystem.BugReportingSystemApp.class).getContext().getResourceMap(JInternalFrameManageProduct.class);
        setTitle(resourceMap.getString("Form.title")); // NOI18N
        setFrameIcon(resourceMap.getIcon("Form.frameIcon")); // NOI18N
        setName("Form"); // NOI18N
        setPreferredSize(new java.awt.Dimension(1018, 607));

        jPanel5.setName("jPanel5"); // NOI18N
        jPanel5.setLayout(new java.awt.BorderLayout());

        jPanel6.setName("jPanel6"); // NOI18N
        jPanel6.setPreferredSize(new java.awt.Dimension(1005, 580));
        jPanel6.setLayout(new java.awt.BorderLayout());

        jTabbedPane1.setForeground(resourceMap.getColor("jTabbedPane1.foreground")); // NOI18N
        jTabbedPane1.setFont(resourceMap.getFont("jTabbedPane1.font")); // NOI18N
        jTabbedPane1.setName("jTabbedPane1"); // NOI18N
        jTabbedPane1.setPreferredSize(new java.awt.Dimension(1005, 595));
        jTabbedPane1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTabbedPane1MouseClicked(evt);
            }
        });

        jPanelProducer.setName("jPanelProducer"); // NOI18N
        jPanelProducer.setLayout(new java.awt.BorderLayout(0, 10));

        jPanelTitle2.setMinimumSize(new java.awt.Dimension(188, 35));
        jPanelTitle2.setName("jPanelTitle2"); // NOI18N
        jPanelTitle2.setPreferredSize(new java.awt.Dimension(176, 85));
        jPanelTitle2.setRequestFocusEnabled(false);
        jPanelTitle2.setVerifyInputWhenFocusTarget(false);
        jPanelTitle2.setLayout(new java.awt.BorderLayout());
        jPanelProducer.add(jPanelTitle2, java.awt.BorderLayout.PAGE_START);

        jPanel3.setName("jPanel3"); // NOI18N
        jPanel3.setPreferredSize(new java.awt.Dimension(436, 300));
        jPanel3.setLayout(new java.awt.GridLayout(2, 1, 0, 15));

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), resourceMap.getString("jPanel1.border.title"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, resourceMap.getFont("jPanel1.border.titleFont"), resourceMap.getColor("jPanel1.border.titleColor"))); // NOI18N
        jPanel1.setName("jPanel1"); // NOI18N
        jPanel1.setPreferredSize(new java.awt.Dimension(436, 140));
        jPanel1.setLayout(new java.awt.BorderLayout());

        jPanelName2.setAutoscrolls(true);
        jPanelName2.setMinimumSize(new java.awt.Dimension(399, 159));
        jPanelName2.setName("jPanelName2"); // NOI18N
        jPanelName2.setPreferredSize(new java.awt.Dimension(384, 115));
        jPanelName2.setRequestFocusEnabled(false);
        jPanelName2.setLayout(new java.awt.BorderLayout(50, 20));

        jLabelNameProducer.setForeground(resourceMap.getColor("jLabelNameProducer.foreground")); // NOI18N
        jLabelNameProducer.setText(resourceMap.getString("jLabelNameProducer.text")); // NOI18N
        jLabelNameProducer.setName("jLabelNameProducer"); // NOI18N
        jPanelName2.add(jLabelNameProducer, java.awt.BorderLayout.LINE_START);

        jTextFieldNameProducer.setName("jTextFieldNameProducer"); // NOI18N
        jPanelName2.add(jTextFieldNameProducer, java.awt.BorderLayout.CENTER);

        jPanel8.setName("jPanel8"); // NOI18N
        jPanel8.setPreferredSize(new java.awt.Dimension(372, 30));
        jPanel8.setLayout(new java.awt.GridLayout(1, 4, 2, 0));

        jButtonAdd.setForeground(resourceMap.getColor("jButtonAdd.foreground")); // NOI18N
        jButtonAdd.setIcon(resourceMap.getIcon("jButtonAdd.icon")); // NOI18N
        jButtonAdd.setText(resourceMap.getString("jButtonAdd.text")); // NOI18N
        jButtonAdd.setName("jButtonAdd"); // NOI18N
        jButtonAdd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonAddActionPerformed(evt);
            }
        });
        jPanel8.add(jButtonAdd);

        jButtonUpdate.setIcon(resourceMap.getIcon("jButtonUpdate.icon")); // NOI18N
        jButtonUpdate.setText(resourceMap.getString("jButtonUpdate.text")); // NOI18N
        jButtonUpdate.setName("jButtonUpdate"); // NOI18N
        jButtonUpdate.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonUpdateActionPerformed(evt);
            }
        });
        jPanel8.add(jButtonUpdate);

        jButtonDelete.setIcon(resourceMap.getIcon("jButtonDelete.icon")); // NOI18N
        jButtonDelete.setText(resourceMap.getString("jButtonDelete.text")); // NOI18N
        jButtonDelete.setName("jButtonDelete"); // NOI18N
        jButtonDelete.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonDeleteActionPerformed(evt);
            }
        });
        jPanel8.add(jButtonDelete);

        jButtonReset.setIcon(resourceMap.getIcon("jButtonReset.icon")); // NOI18N
        jButtonReset.setText(resourceMap.getString("jButtonReset.text")); // NOI18N
        jButtonReset.setName("jButtonReset"); // NOI18N
        jButtonReset.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonResetActionPerformed(evt);
            }
        });
        jPanel8.add(jButtonReset);

        jPanelName2.add(jPanel8, java.awt.BorderLayout.PAGE_END);

        jPanel1.add(jPanelName2, java.awt.BorderLayout.CENTER);

        jLabel1.setMaximumSize(new java.awt.Dimension(20, 16));
        jLabel1.setMinimumSize(new java.awt.Dimension(20, 16));
        jLabel1.setName("jLabel1"); // NOI18N
        jLabel1.setPreferredSize(new java.awt.Dimension(20, 16));
        jPanel1.add(jLabel1, java.awt.BorderLayout.LINE_END);

        jLabel2.setMaximumSize(new java.awt.Dimension(41, 10));
        jLabel2.setMinimumSize(new java.awt.Dimension(41, 10));
        jLabel2.setName("jLabel2"); // NOI18N
        jLabel2.setPreferredSize(new java.awt.Dimension(41, 10));
        jPanel1.add(jLabel2, java.awt.BorderLayout.PAGE_START);

        jLabel3.setMaximumSize(new java.awt.Dimension(41, 10));
        jLabel3.setMinimumSize(new java.awt.Dimension(41, 10));
        jLabel3.setName("jLabel3"); // NOI18N
        jLabel3.setPreferredSize(new java.awt.Dimension(41, 10));
        jPanel1.add(jLabel3, java.awt.BorderLayout.PAGE_END);

        jLabel12.setMaximumSize(new java.awt.Dimension(20, 16));
        jLabel12.setMinimumSize(new java.awt.Dimension(20, 16));
        jLabel12.setName("jLabel12"); // NOI18N
        jLabel12.setPreferredSize(new java.awt.Dimension(20, 16));
        jPanel1.add(jLabel12, java.awt.BorderLayout.LINE_START);

        jPanel3.add(jPanel1);

        jPanelTabale2.setMinimumSize(new java.awt.Dimension(399, 0));
        jPanelTabale2.setName("jPanelTabale2"); // NOI18N
        jPanelTabale2.setOpaque(false);
        jPanelTabale2.setPreferredSize(new java.awt.Dimension(380, 104));
        jPanelTabale2.setLayout(new java.awt.BorderLayout());

        jScrollPane2.setName("jScrollPane2"); // NOI18N
        jScrollPane2.setPreferredSize(new java.awt.Dimension(375, 300));

        jTableProducer.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {},
                {},
                {},
                {},
                {},
                {}
            },
            new String [] {

            }
        ));
        jTableProducer.setName("jTableProducer"); // NOI18N
        jTableProducer.setPreferredSize(new java.awt.Dimension(300, 250));
        jTableProducer.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jTableProducer.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTableProducerMouseClicked(evt);
            }
        });
        jTableProducer.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jTableProducerKeyReleased(evt);
            }
        });
        jScrollPane2.setViewportView(jTableProducer);

        jPanelTabale2.add(jScrollPane2, java.awt.BorderLayout.CENTER);

        jPanel3.add(jPanelTabale2);

        jPanelProducer.add(jPanel3, java.awt.BorderLayout.CENTER);

        jPanel2.setName("jPanel2"); // NOI18N
        jPanel2.setPreferredSize(new java.awt.Dimension(280, 190));
        jPanelProducer.add(jPanel2, java.awt.BorderLayout.PAGE_END);

        jPanel20.setName("jPanel20"); // NOI18N
        jPanel20.setPreferredSize(new java.awt.Dimension(260, 10));
        jPanel20.setLayout(new java.awt.BorderLayout());

        jPanel22.setName("jPanel22"); // NOI18N
        jPanel22.setPreferredSize(new java.awt.Dimension(100, 30));
        jPanel20.add(jPanel22, java.awt.BorderLayout.PAGE_START);

        jPanel23.setName("jPanel23"); // NOI18N
        jPanel23.setPreferredSize(new java.awt.Dimension(109, 210));
        jPanel20.add(jPanel23, java.awt.BorderLayout.PAGE_END);

        jPanel24.setName("jPanel24"); // NOI18N
        jPanel24.setLayout(new java.awt.BorderLayout());

        NameProducer1.setFont(resourceMap.getFont("NameProducer1.font")); // NOI18N
        NameProducer1.setForeground(resourceMap.getColor("NameProducer1.foreground")); // NOI18N
        NameProducer1.setName("NameProducer1"); // NOI18N
        jPanel24.add(NameProducer1, java.awt.BorderLayout.CENTER);

        jPanel20.add(jPanel24, java.awt.BorderLayout.CENTER);

        jPanelProducer.add(jPanel20, java.awt.BorderLayout.LINE_END);

        jPanel21.setName("jPanel21"); // NOI18N
        jPanel21.setPreferredSize(new java.awt.Dimension(240, 10));
        jPanelProducer.add(jPanel21, java.awt.BorderLayout.LINE_START);

        jTabbedPane1.addTab(resourceMap.getString("jPanelProducer.TabConstraints.tabTitle"), jPanelProducer); // NOI18N

        jPanelProduce.setName("jPanelProduce"); // NOI18N
        jPanelProduce.setLayout(new java.awt.BorderLayout(0, 10));

        jPanelManage_Produce.setName("jPanelManage_Produce"); // NOI18N
        jPanelManage_Produce.setPreferredSize(new java.awt.Dimension(75, 60));
        jPanelManage_Produce.setLayout(new java.awt.GridBagLayout());
        jPanelProduce.add(jPanelManage_Produce, java.awt.BorderLayout.PAGE_START);

        jPanelBody.setName("jPanelBody"); // NOI18N
        jPanelBody.setLayout(new java.awt.BorderLayout());

        jPanelIfomation.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), resourceMap.getString("jPanelIfomation.border.title"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, resourceMap.getFont("jPanelIfomation.border.titleFont"), resourceMap.getColor("jPanelIfomation.border.titleColor"))); // NOI18N
        jPanelIfomation.setForeground(resourceMap.getColor("jPanelIfomation.foreground")); // NOI18N
        jPanelIfomation.setName("jPanelIfomation"); // NOI18N
        jPanelIfomation.setLayout(new java.awt.BorderLayout());

        jPanel4.setName("jPanel4"); // NOI18N
        jPanel4.setLayout(new java.awt.BorderLayout(0, 15));

        jPanel7.setName("jPanel7"); // NOI18N
        jPanel7.setLayout(new java.awt.GridLayout(1, 2, 65, 0));

        jPanel9.setName("jPanel9"); // NOI18N
        jPanel9.setPreferredSize(new java.awt.Dimension(930, 60));
        jPanel9.setLayout(new java.awt.BorderLayout(10, 0));

        jPanel10.setName("jPanel10"); // NOI18N
        jPanel10.setLayout(new java.awt.GridLayout(6, 1));

        jLabel13.setText(resourceMap.getString("jLabel13.text")); // NOI18N
        jLabel13.setName("jLabel13"); // NOI18N
        jPanel10.add(jLabel13);

        __.setName("__"); // NOI18N
        jPanel10.add(__);

        jLabel14.setText(resourceMap.getString("jLabel14.text")); // NOI18N
        jLabel14.setName("jLabel14"); // NOI18N
        jPanel10.add(jLabel14);

        __1.setName("__1"); // NOI18N
        jPanel10.add(__1);

        jLabel15.setText(resourceMap.getString("jLabel15.text")); // NOI18N
        jLabel15.setName("jLabel15"); // NOI18N
        jPanel10.add(jLabel15);

        __2.setName("__2"); // NOI18N
        jPanel10.add(__2);

        jPanel9.add(jPanel10, java.awt.BorderLayout.LINE_START);

        jPanel11.setName("jPanel11"); // NOI18N
        jPanel11.setLayout(new java.awt.GridLayout(6, 0));

        jTextFieldNameProduce.setMinimumSize(new java.awt.Dimension(190, 22));
        jTextFieldNameProduce.setName("jTextFieldNameProduce"); // NOI18N
        jTextFieldNameProduce.setPreferredSize(new java.awt.Dimension(190, 22));
        jPanel11.add(jTextFieldNameProduce);

        jLabelNameProduce.setFont(resourceMap.getFont("jLabelNameProduce.font")); // NOI18N
        jLabelNameProduce.setForeground(resourceMap.getColor("jLabelNameProduce.foreground")); // NOI18N
        jLabelNameProduce.setName("jLabelNameProduce"); // NOI18N
        jPanel11.add(jLabelNameProduce);

        jTextFieldPrice.setName("jTextFieldPrice"); // NOI18N
        jPanel11.add(jTextFieldPrice);

        jLabelPrice.setFont(resourceMap.getFont("jLabelPrice.font")); // NOI18N
        jLabelPrice.setForeground(resourceMap.getColor("jLabelPrice.foreground")); // NOI18N
        jLabelPrice.setName("jLabelPrice"); // NOI18N
        jPanel11.add(jLabelPrice);

        jPanel28.setName("jPanel28"); // NOI18N
        jPanel28.setLayout(new java.awt.GridLayout(1, 2, 10, 0));

        jTextFieldWarranty.setText(resourceMap.getString("jTextFieldWarranty.text")); // NOI18N
        jTextFieldWarranty.setName("jTextFieldWarranty"); // NOI18N
        jPanel28.add(jTextFieldWarranty);

        jLabelMonth.setText(resourceMap.getString("jLabelMonth.text")); // NOI18N
        jLabelMonth.setName("jLabelMonth"); // NOI18N
        jPanel28.add(jLabelMonth);

        jPanel11.add(jPanel28);

        jLabelWarranty.setFont(resourceMap.getFont("jLabelWarranty.font")); // NOI18N
        jLabelWarranty.setForeground(resourceMap.getColor("jLabelWarranty.foreground")); // NOI18N
        jLabelWarranty.setName("jLabelWarranty"); // NOI18N
        jPanel11.add(jLabelWarranty);

        jPanel9.add(jPanel11, java.awt.BorderLayout.CENTER);

        jPanel7.add(jPanel9);

        jPanel12.setMinimumSize(new java.awt.Dimension(100, 120));
        jPanel12.setName("jPanel12"); // NOI18N
        jPanel12.setLayout(new java.awt.BorderLayout(10, 0));

        jPanel13.setName("jPanel13"); // NOI18N
        jPanel13.setLayout(new java.awt.GridLayout(6, 1));

        jLabelID.setText(resourceMap.getString("jLabelID.text")); // NOI18N
        jLabelID.setName("jLabelID"); // NOI18N
        jPanel13.add(jLabelID);

        jLabel24.setText(resourceMap.getString("jLabel24.text")); // NOI18N
        jLabel24.setName("jLabel24"); // NOI18N
        jPanel13.add(jLabel24);

        jLabel16.setText(resourceMap.getString("jLabel16.text")); // NOI18N
        jLabel16.setName("jLabel16"); // NOI18N
        jPanel13.add(jLabel16);

        jPanel12.add(jPanel13, java.awt.BorderLayout.LINE_START);

        jPanel14.setName("jPanel14"); // NOI18N
        jPanel14.setLayout(new java.awt.BorderLayout());

        jPanel15.setName("jPanel15"); // NOI18N
        jPanel15.setPreferredSize(new java.awt.Dimension(31, 50));
        jPanel15.setLayout(new java.awt.GridLayout(2, 1));

        jComboBoxIdProducer.setName("jComboBoxIdProducer"); // NOI18N
        jPanel15.add(jComboBoxIdProducer);

        jLabelID1.setFont(resourceMap.getFont("jLabelID1.font")); // NOI18N
        jLabelID1.setForeground(resourceMap.getColor("jLabelID1.foreground")); // NOI18N
        jLabelID1.setName("jLabelID1"); // NOI18N
        jPanel15.add(jLabelID1);

        jPanel14.add(jPanel15, java.awt.BorderLayout.PAGE_START);

        jPanel25.setName("jPanel25"); // NOI18N
        jPanel25.setLayout(new java.awt.BorderLayout());

        jPanel26.setName("jPanel26"); // NOI18N
        jPanel26.setPreferredSize(new java.awt.Dimension(100, 70));
        jPanel26.setLayout(new java.awt.BorderLayout());

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        jTextAreaInformation.setColumns(20);
        jTextAreaInformation.setRows(5);
        jTextAreaInformation.setName("jTextAreaInformation"); // NOI18N
        jScrollPane1.setViewportView(jTextAreaInformation);

        jPanel26.add(jScrollPane1, java.awt.BorderLayout.CENTER);

        jPanel25.add(jPanel26, java.awt.BorderLayout.PAGE_START);

        jPanel27.setName("jPanel27"); // NOI18N
        jPanel27.setLayout(new java.awt.BorderLayout());

        jLabelInformation.setFont(resourceMap.getFont("jLabelInformation.font")); // NOI18N
        jLabelInformation.setForeground(resourceMap.getColor("jLabelInformation.foreground")); // NOI18N
        jLabelInformation.setName("jLabelInformation"); // NOI18N
        jPanel27.add(jLabelInformation, java.awt.BorderLayout.CENTER);

        jPanel25.add(jPanel27, java.awt.BorderLayout.CENTER);

        jPanel14.add(jPanel25, java.awt.BorderLayout.CENTER);

        jPanel12.add(jPanel14, java.awt.BorderLayout.CENTER);

        jPanel7.add(jPanel12);

        jPanel4.add(jPanel7, java.awt.BorderLayout.CENTER);

        jPanel16.setName("jPanel16"); // NOI18N
        jPanel16.setPreferredSize(new java.awt.Dimension(280, 30));
        jPanel16.setLayout(new java.awt.BorderLayout());

        jPanel17.setName("jPanel17"); // NOI18N
        jPanel17.setPreferredSize(new java.awt.Dimension(130, 100));
        jPanel16.add(jPanel17, java.awt.BorderLayout.LINE_START);

        jPanel18.setName("jPanel18"); // NOI18N
        jPanel18.setLayout(new java.awt.GridLayout(1, 5, 5, 0));

        jButtonadd.setForeground(resourceMap.getColor("jButtonadd.foreground")); // NOI18N
        jButtonadd.setIcon(resourceMap.getIcon("jButtonadd.icon")); // NOI18N
        jButtonadd.setText(resourceMap.getString("jButtonadd.text")); // NOI18N
        jButtonadd.setMaximumSize(new java.awt.Dimension(92, 25));
        jButtonadd.setMinimumSize(new java.awt.Dimension(92, 25));
        jButtonadd.setName("jButtonadd"); // NOI18N
        jButtonadd.setPreferredSize(new java.awt.Dimension(92, 25));
        jButtonadd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonaddActionPerformed(evt);
            }
        });
        jPanel18.add(jButtonadd);

        jButtonUpdate1.setIcon(resourceMap.getIcon("jButtonUpdate1.icon")); // NOI18N
        jButtonUpdate1.setText(resourceMap.getString("jButtonUpdate1.text")); // NOI18N
        jButtonUpdate1.setMaximumSize(new java.awt.Dimension(92, 25));
        jButtonUpdate1.setMinimumSize(new java.awt.Dimension(92, 25));
        jButtonUpdate1.setName("jButtonUpdate1"); // NOI18N
        jButtonUpdate1.setPreferredSize(new java.awt.Dimension(92, 25));
        jButtonUpdate1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonUpdate1ActionPerformed(evt);
            }
        });
        jPanel18.add(jButtonUpdate1);

        jButtonClean.setIcon(resourceMap.getIcon("jButtonClean.icon")); // NOI18N
        jButtonClean.setText(resourceMap.getString("jButtonClean.text")); // NOI18N
        jButtonClean.setMaximumSize(new java.awt.Dimension(92, 25));
        jButtonClean.setMinimumSize(new java.awt.Dimension(92, 25));
        jButtonClean.setName("jButtonClean"); // NOI18N
        jButtonClean.setPreferredSize(new java.awt.Dimension(92, 25));
        jButtonClean.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonCleanActionPerformed(evt);
            }
        });
        jPanel18.add(jButtonClean);

        jButtonDelete1.setIcon(resourceMap.getIcon("jButtonDelete1.icon")); // NOI18N
        jButtonDelete1.setText(resourceMap.getString("jButtonDelete1.text")); // NOI18N
        jButtonDelete1.setMaximumSize(new java.awt.Dimension(92, 25));
        jButtonDelete1.setMinimumSize(new java.awt.Dimension(92, 25));
        jButtonDelete1.setName("jButtonDelete1"); // NOI18N
        jButtonDelete1.setPreferredSize(new java.awt.Dimension(92, 25));
        jButtonDelete1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonDelete1ActionPerformed(evt);
            }
        });
        jPanel18.add(jButtonDelete1);

        jButtonReset1.setIcon(resourceMap.getIcon("jButtonReset1.icon")); // NOI18N
        jButtonReset1.setText(resourceMap.getString("jButtonReset1.text")); // NOI18N
        jButtonReset1.setMaximumSize(new java.awt.Dimension(92, 25));
        jButtonReset1.setMinimumSize(new java.awt.Dimension(92, 25));
        jButtonReset1.setName("jButtonReset1"); // NOI18N
        jButtonReset1.setPreferredSize(new java.awt.Dimension(92, 25));
        jButtonReset1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonReset1ActionPerformed(evt);
            }
        });
        jPanel18.add(jButtonReset1);

        jPanel16.add(jPanel18, java.awt.BorderLayout.CENTER);

        jPanel4.add(jPanel16, java.awt.BorderLayout.PAGE_END);

        jPanelIfomation.add(jPanel4, java.awt.BorderLayout.CENTER);

        jLabel17.setName("jLabel17"); // NOI18N
        jLabel17.setPreferredSize(new java.awt.Dimension(10, 16));
        jPanelIfomation.add(jLabel17, java.awt.BorderLayout.LINE_END);

        jLabel18.setName("jLabel18"); // NOI18N
        jLabel18.setPreferredSize(new java.awt.Dimension(10, 10));
        jPanelIfomation.add(jLabel18, java.awt.BorderLayout.LINE_START);

        jLabel19.setName("jLabel19"); // NOI18N
        jLabel19.setPreferredSize(new java.awt.Dimension(0, 10));
        jPanelIfomation.add(jLabel19, java.awt.BorderLayout.PAGE_START);

        jLabel20.setName("jLabel20"); // NOI18N
        jLabel20.setPreferredSize(new java.awt.Dimension(0, 10));
        jPanelIfomation.add(jLabel20, java.awt.BorderLayout.PAGE_END);

        jPanelBody.add(jPanelIfomation, java.awt.BorderLayout.CENTER);

        jPanel19.setName("jPanel19"); // NOI18N
        jPanel19.setPreferredSize(new java.awt.Dimension(576, 200));
        jPanel19.setLayout(new java.awt.GridBagLayout());

        jScrollPane3.setName("jScrollPane3"); // NOI18N
        jScrollPane3.setPreferredSize(new java.awt.Dimension(375, 300));

        jTableProduce.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {},
                {},
                {},
                {},
                {},
                {}
            },
            new String [] {

            }
        ));
        jTableProduce.setName("jTableProduce"); // NOI18N
        jTableProduce.setPreferredSize(new java.awt.Dimension(300, 250));
        jTableProduce.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jTableProduce.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTableProduceMouseClicked(evt);
            }
        });
        jTableProduce.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jTableProduceKeyReleased(evt);
            }
        });
        jScrollPane3.setViewportView(jTableProduce);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        jPanel19.add(jScrollPane3, gridBagConstraints);

        jPanelBody.add(jPanel19, java.awt.BorderLayout.PAGE_END);

        jPanelProduce.add(jPanelBody, java.awt.BorderLayout.CENTER);

        jLabel21.setText(resourceMap.getString("jLabel21.text")); // NOI18N
        jLabel21.setName("jLabel21"); // NOI18N
        jLabel21.setPreferredSize(new java.awt.Dimension(0, 45));
        jPanelProduce.add(jLabel21, java.awt.BorderLayout.PAGE_END);

        jLabel22.setText(resourceMap.getString("jLabel22.text")); // NOI18N
        jLabel22.setName("jLabel22"); // NOI18N
        jLabel22.setPreferredSize(new java.awt.Dimension(125, 0));
        jPanelProduce.add(jLabel22, java.awt.BorderLayout.LINE_END);

        jLabel23.setText(resourceMap.getString("jLabel23.text")); // NOI18N
        jLabel23.setName("jLabel23"); // NOI18N
        jLabel23.setPreferredSize(new java.awt.Dimension(125, 0));
        jPanelProduce.add(jLabel23, java.awt.BorderLayout.LINE_START);

        jTabbedPane1.addTab(resourceMap.getString("jPanelProduce.TabConstraints.tabTitle"), jPanelProduce); // NOI18N

        jPanel6.add(jTabbedPane1, java.awt.BorderLayout.PAGE_START);

        jPanel5.add(jPanel6, java.awt.BorderLayout.CENTER);

        jLabel5.setName("jLabel5"); // NOI18N
        jLabel5.setPreferredSize(new java.awt.Dimension(0, 10));
        jPanel5.add(jLabel5, java.awt.BorderLayout.PAGE_START);

        jLabel6.setName("jLabel6"); // NOI18N
        jLabel6.setPreferredSize(new java.awt.Dimension(0, 10));
        jPanel5.add(jLabel6, java.awt.BorderLayout.PAGE_END);

        jLabel7.setName("jLabel7"); // NOI18N
        jLabel7.setPreferredSize(new java.awt.Dimension(10, 0));
        jPanel5.add(jLabel7, java.awt.BorderLayout.LINE_END);

        jLabel8.setName("jLabel8"); // NOI18N
        jLabel8.setPreferredSize(new java.awt.Dimension(10, 0));
        jPanel5.add(jLabel8, java.awt.BorderLayout.LINE_START);

        getContentPane().add(jPanel5, java.awt.BorderLayout.CENTER);

        pack();
    }// </editor-fold>//GEN-END:initComponents
    private void jButtonAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAddActionPerformed
        String name = this.jTextFieldNameProducer.getText();
        if (!CommonQuery.CheckString(name)) {
            this.NameProducer1.setText(rb.getString("InputNameProducer"));
        } else if (!CheckNameProducer(this.jTextFieldNameProducer.getText())) {
            this.NameProducer1.setText(rb.getString("InputNameProducer1"));
        } else {
            Producer pdr = new Producer();
            pdr.setNameproducer(name);
            if (pdr.AddProducer()) {
                JOptionPane.showMessageDialog(null, rb.getString("AddSuccessfully"));
                DisplayTableProducer(Producer.ListIDProducer());
                this.jTextFieldNameProducer.setText("");
                this.NameProducer1.setText("");
            } else {
                JOptionPane.showMessageDialog(null, rb.getString("AddFail"));
                this.NameProducer1.setText("");
            }
        }
}//GEN-LAST:event_jButtonAddActionPerformed
    private void jButtonUpdateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonUpdateActionPerformed
        String name1 = this.jTextFieldNameProducer.getText();
        if (rowcer < 0) {
            JOptionPane.showMessageDialog(null, rb.getString("ChooseProducerUpdate"));
        } else if (!CommonQuery.CheckString(name1)) {
            this.NameProducer1.setText(rb.getString("InputNameProducer"));
        } else {
            Producer pdr = new Producer();
            pdr.setIdproducer(idemcer);
            pdr.setNameproducer(name1);
            if (pdr.UpdateProducer()) {
                JOptionPane.showMessageDialog(null, rb.getString("UpdateSuccessfully"));
                DisplayTableProducer(Producer.ListIDProducerOnId(idemcer));
                this.jTextFieldNameProducer.setText("");
                this.NameProducer1.setText("");
                rowcer = -1;
            } else {
                JOptionPane.showMessageDialog(null, rb.getString("UpdateFail"));
                this.NameProducer1.setText("");
            }

        }
}//GEN-LAST:event_jButtonUpdateActionPerformed

    private void jButtonDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonDeleteActionPerformed
        if (rowcer < 0) {
            JOptionPane.showMessageDialog(null, rb.getString("chooseproducerdelete"));
        } else {
            Producer pdr = new Producer();
            pdr.setIdproducer(idemcer);
            int value = JOptionPane.showConfirmDialog(null, rb.getString("suredelete"), rb.getString("Accept"), JOptionPane.YES_NO_CANCEL_OPTION);
            if (value == JOptionPane.OK_OPTION) {
                if (pdr.DeleteProducer()) {
                    DisplayTableProducer(Producer.ListIDProducer());
                    this.jTextFieldNameProducer.setText("");
                    this.NameProducer1.setText("");
                } else {
                    JOptionPane.showMessageDialog(null, rb.getString("produceisused"));
                }
            }
        }
}//GEN-LAST:event_jButtonDeleteActionPerformed

    private void jTableProducerMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTableProducerMouseClicked
        // TODO add your handling code here:
        try {
            DisplayProducer();
            this.NameProducer1.setText("");
        } catch (Exception e) {
        }
}//GEN-LAST:event_jTableProducerMouseClicked

    private void jButtonaddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonaddActionPerformed
        String nameproduce = this.jTextFieldNameProduce.getText();
        String price = this.jTextFieldPrice.getText();
        String warranty = this.jTextFieldWarranty.getText();
        String infor = this.jTextAreaInformation.getText();

        if (!CommonQuery.CheckString(nameproduce)) {
            this.jLabelNameProduce.setText(rb.getString("CheckNameProduce"));
            this.jLabelPrice.setText("");
            this.jLabelWarranty.setText("");
            this.jLabelInformation.setText("");
        } else if (!CheckNameProduce(this.jTextFieldNameProduce.getText())) {
            this.jLabelNameProduce.setText(rb.getString("InputNameProduce1"));
            this.jLabelPrice.setText("");
            this.jLabelWarranty.setText("");
            this.jLabelInformation.setText("");

        } else if (price.length() == 0) {
            this.jLabelNameProduce.setText("");
            this.jLabelPrice.setText(rb.getString("CheckPrice"));
            this.jLabelWarranty.setText("");
            this.jLabelInformation.setText("");
        } else if (!CommonQuery.CheckDoubleNumber(price)) {
            this.jLabelNameProduce.setText("");
            this.jLabelPrice.setText(rb.getString("CheckPrice1"));
            this.jLabelWarranty.setText("");
            this.jLabelInformation.setText("");
        } else if (warranty.length() == 0) {
            this.jLabelNameProduce.setText("");
            this.jLabelPrice.setText("");
            this.jLabelWarranty.setText(rb.getString("CheckWarranty"));
            this.jLabelInformation.setText("");
        } else if (!CommonQuery.CheckIntNumber(warranty)) {
            this.jLabelNameProduce.setText("");
            this.jLabelPrice.setText("");
            this.jLabelWarranty.setText(rb.getString("CheckWarranty1"));
            this.jLabelInformation.setText("");
        } else if (Integer.parseInt(warranty) > 24) {
            this.jLabelNameProduce.setText("");
            this.jLabelPrice.setText("");
            this.jLabelWarranty.setText(rb.getString("CheckWarranty2"));
            this.jLabelInformation.setText("");
        } else if (!CommonQuery.CheckString(infor)) {
            this.jLabelNameProduce.setText("");
            this.jLabelPrice.setText("");
            this.jLabelWarranty.setText("");
            this.jLabelInformation.setText(rb.getString("CheckInformation"));
        } else {
            int index = jComboBoxIdProducer.getSelectedIndex();

            Produce pd = new Produce();
            pd.setNameproduce(nameproduce);
            pd.setPrice(Double.valueOf(price));
            pd.setWarranty(Integer.valueOf(warranty));
            pd.setInfor(infor);
            pd.setIdproducer(IdProducer.get(index));
            if (pd.AddProduce()) {
                JOptionPane.showMessageDialog(null, rb.getString("AddSuccessfully"));
                DisplayTableProduce(Produce.ListIDProducec());
                this.jTextFieldNameProduce.setText("");
                this.jTextFieldPrice.setText("");
                this.jTextFieldWarranty.setText("");
                this.jTextAreaInformation.setText("");
                this.jLabelNameProduce.setText("");
                this.jLabelPrice.setText("");
                this.jLabelWarranty.setText("");
                this.jLabelInformation.setText("");
            } else {
                JOptionPane.showMessageDialog(null, rb.getString("AddFail"));
            }
        }
}//GEN-LAST:event_jButtonaddActionPerformed

    private void jButtonUpdate1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonUpdate1ActionPerformed
        String nameproduce = this.jTextFieldNameProduce.getText();
        String price = this.jTextFieldPrice.getText();
        String warranty = this.jTextFieldWarranty.getText();
        String infor = this.jTextAreaInformation.getText();

        if (row < 0) {
            JOptionPane.showMessageDialog(null, rb.getString("chooseproduceupdate"));
        }
        if (!CommonQuery.CheckString(nameproduce)) {
            this.jLabelNameProduce.setText(rb.getString("CheckNameProduce"));
            this.jLabelPrice.setText("");
            this.jLabelWarranty.setText("");
            this.jLabelInformation.setText("");
        } else if (price.length() == 0) {
            this.jLabelNameProduce.setText("");
            this.jLabelPrice.setText(rb.getString("CheckPrice"));
            this.jLabelWarranty.setText("");
            this.jLabelInformation.setText("");
        } else if (!CommonQuery.CheckDoubleNumber(price)) {
            this.jLabelNameProduce.setText("");
            this.jLabelPrice.setText(rb.getString("CheckPrice1"));
            this.jLabelWarranty.setText("");
            this.jLabelInformation.setText("");
        } else if (warranty.length() == 0) {
            this.jLabelNameProduce.setText("");
            this.jLabelPrice.setText("");
            this.jLabelWarranty.setText(rb.getString("CheckWarranty"));
            this.jLabelInformation.setText("");
        } else if (!CommonQuery.CheckIntNumber(warranty)) {
            this.jLabelNameProduce.setText("");
            this.jLabelPrice.setText("");
            this.jLabelWarranty.setText(rb.getString("CheckWarranty1"));
            this.jLabelInformation.setText("");
        } else if (Integer.parseInt(warranty) > 24) {
            this.jLabelNameProduce.setText("");
            this.jLabelPrice.setText("");
            this.jLabelWarranty.setText(rb.getString("CheckWarranty2"));
            this.jLabelInformation.setText("");
        } else if (!CommonQuery.CheckString(infor)) {
            this.jLabelNameProduce.setText("");
            this.jLabelPrice.setText("");
            this.jLabelWarranty.setText("");
            this.jLabelInformation.setText(rb.getString("CheckInformation"));
        } else {
            Produce pd = new Produce();
            int index = jComboBoxIdProducer.getSelectedIndex();
            pd.setIdproduce(idem);
            pd.setNameproduce(nameproduce);
            pd.setPrice(Double.valueOf(price));
            pd.setWarranty(Integer.valueOf(warranty));
            pd.setIdproducer(IdProducer.get(index));
            pd.setInfor(infor);
            if (pd.UpdateProduce()) {
                JOptionPane.showMessageDialog(null, rb.getString("UpdateSuccessfully"));
                DisplayTableProduce(Produce.ListProduceonidproduce(idem));
                this.jTextFieldNameProduce.setText("");
                this.jTextFieldPrice.setText("");
                this.jTextFieldWarranty.setText("");
                this.jTextAreaInformation.setText("");
                this.jLabelNameProduce.setText("");
                this.jLabelPrice.setText("");
                this.jLabelWarranty.setText("");
                this.jLabelInformation.setText("");
                row = -1;
            } else {
                JOptionPane.showMessageDialog(null, rb.getString("UpdateFail"));
            }
        }
}//GEN-LAST:event_jButtonUpdate1ActionPerformed

    private void jButtonCleanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCleanActionPerformed
        this.jTextFieldNameProduce.setText("");
        this.jTextFieldPrice.setText("");
        this.jTextFieldWarranty.setText("");
        this.jTextAreaInformation.setText("");
        this.jLabelNameProduce.setText("");
        this.jLabelPrice.setText("");
        this.jLabelWarranty.setText("");
        this.jLabelInformation.setText("");

}//GEN-LAST:event_jButtonCleanActionPerformed

    private void jButtonDelete1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonDelete1ActionPerformed
        if (row < 0) {
            JOptionPane.showMessageDialog(null, rb.getString("chooseproducedelete"));
        } else {
            Produce pd = new Produce();
            pd.setIdproduce(idem);
            int value = JOptionPane.showConfirmDialog(null, rb.getString("suredelete"), rb.getString("Accept"), JOptionPane.YES_NO_CANCEL_OPTION);
            if (value == JOptionPane.OK_OPTION) {
                if (pd.DeleteProduce()) {
                    DisplayTableProduce(Produce.ListIDProducec());
                    this.jTextFieldNameProduce.setText("");
                    this.jTextFieldPrice.setText("");
                    this.jTextFieldWarranty.setText("");
                    this.jTextAreaInformation.setText("");
                    this.jLabelNameProduce.setText("");
                    this.jLabelPrice.setText("");
                    this.jLabelWarranty.setText("");
                    this.jLabelInformation.setText("");
                } else {
                    JOptionPane.showMessageDialog(null, rb.getString("produceisused"));
                }
            }

        }
}//GEN-LAST:event_jButtonDelete1ActionPerformed

    private void jTableProduceMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTableProduceMouseClicked

        try {
            DisplayProduce();
            this.jLabelNameProduce.setText("");
            this.jLabelPrice.setText("");
            this.jLabelWarranty.setText("");
            this.jLabelInformation.setText("");
        } catch (Exception e) {
        }

}//GEN-LAST:event_jTableProduceMouseClicked

    private void jTabbedPane1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTabbedPane1MouseClicked
        // TODO add your handling code here:
        AddNameProducer();
    }//GEN-LAST:event_jTabbedPane1MouseClicked

    private void jTableProducerKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTableProducerKeyReleased
        // TODO add your handling code here:
        try {
            DisplayProducer();
            this.NameProducer1.setText("");
        } catch (Exception e) {
        }
    }//GEN-LAST:event_jTableProducerKeyReleased

    private void jTableProduceKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTableProduceKeyReleased
        // TODO add your handling code here:
        try {
            DisplayProduce();
            this.jLabelNameProduce.setText("");
            this.jLabelPrice.setText("");
            this.jLabelWarranty.setText("");
            this.jLabelInformation.setText("");

        } catch (Exception e) {
        }
    }//GEN-LAST:event_jTableProduceKeyReleased

    private void jButtonResetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonResetActionPerformed
        // TODO add your handling code here:
        try {
            DisplayTableProducer(Producer.ListIDProducer());
            rowcer = -1;
            this.NameProducer1.setText("");
            this.jTextFieldNameProducer.setText("");
            idemcer = -1;
        } catch (Exception e) {
        }
    }//GEN-LAST:event_jButtonResetActionPerformed

    private void jButtonReset1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonReset1ActionPerformed
        // TODO add your handling code here:
        try {
            DisplayTableProduce(Produce.ListIDProducec());
            row = -1;
            this.jTextFieldNameProduce.setText("");
            this.jTextFieldPrice.setText("");
            this.jTextFieldWarranty.setText("");
            this.jTextAreaInformation.setText("");
            this.jLabelNameProduce.setText("");
            this.jLabelPrice.setText("");
            this.jLabelWarranty.setText("");
            this.jLabelInformation.setText("");
            idem = -1;
        } catch (Exception e) {
        }
    }//GEN-LAST:event_jButtonReset1ActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel NameProducer1;
    private javax.swing.JLabel __;
    private javax.swing.JLabel __1;
    private javax.swing.JLabel __2;
    private javax.swing.JButton jButtonAdd;
    private javax.swing.JButton jButtonClean;
    private javax.swing.JButton jButtonDelete;
    private javax.swing.JButton jButtonDelete1;
    private javax.swing.JButton jButtonReset;
    private javax.swing.JButton jButtonReset1;
    private javax.swing.JButton jButtonUpdate;
    private javax.swing.JButton jButtonUpdate1;
    private javax.swing.JButton jButtonadd;
    private javax.swing.JComboBox jComboBoxIdProducer;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabelID;
    private javax.swing.JLabel jLabelID1;
    private javax.swing.JLabel jLabelInformation;
    private javax.swing.JLabel jLabelMonth;
    private javax.swing.JLabel jLabelNameProduce;
    private javax.swing.JLabel jLabelNameProducer;
    private javax.swing.JLabel jLabelPrice;
    private javax.swing.JLabel jLabelWarranty;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel12;
    private javax.swing.JPanel jPanel13;
    private javax.swing.JPanel jPanel14;
    private javax.swing.JPanel jPanel15;
    private javax.swing.JPanel jPanel16;
    private javax.swing.JPanel jPanel17;
    private javax.swing.JPanel jPanel18;
    private javax.swing.JPanel jPanel19;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel20;
    private javax.swing.JPanel jPanel21;
    private javax.swing.JPanel jPanel22;
    private javax.swing.JPanel jPanel23;
    private javax.swing.JPanel jPanel24;
    private javax.swing.JPanel jPanel25;
    private javax.swing.JPanel jPanel26;
    private javax.swing.JPanel jPanel27;
    private javax.swing.JPanel jPanel28;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JPanel jPanelBody;
    private javax.swing.JPanel jPanelIfomation;
    private javax.swing.JPanel jPanelManage_Produce;
    private javax.swing.JPanel jPanelName2;
    private javax.swing.JPanel jPanelProduce;
    private javax.swing.JPanel jPanelProducer;
    private javax.swing.JPanel jPanelTabale2;
    private javax.swing.JPanel jPanelTitle2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTable jTableProduce;
    private javax.swing.JTable jTableProducer;
    private javax.swing.JTextArea jTextAreaInformation;
    private javax.swing.JTextField jTextFieldNameProduce;
    private javax.swing.JTextField jTextFieldNameProducer;
    private javax.swing.JTextField jTextFieldPrice;
    private javax.swing.JTextField jTextFieldWarranty;
    // End of variables declaration//GEN-END:variables
}
